package pl.edu.pw.perg.compinfodb.ui;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JTable;

import pl.edu.pw.perg.compinfodb.datamodel.HistoryTableModel;

public class HistoryKeyListener implements KeyListener {

	
	
	
	public void keyPressed(KeyEvent e) {
		HistoryTableModel tm = ((HistoryTableModel) ((JTable) e.getSource()).getModel());
		if (e.getKeyCode() == KeyEvent.VK_F5)
			tm.refresh();
		else if (e.getKeyCode() == KeyEvent.VK_F6)
			tm.createEvent();
		else if (e.getKeyCode() == KeyEvent.VK_F7)
			tm.saveItems();

	}

	public void keyReleased(KeyEvent e) {
		// TODO Auto-generated method stub

	}

	public void keyTyped(KeyEvent e) {
		// TODO Auto-generated method stub

	}

}
